#ifndef TREADMILL_TREADMILLCOMMANDUTIL_H
#define TREADMILL_TREADMILLCOMMANDUTIL_H

#include <string>
#include <vector>

class TreadMillCommandUtil {
public:
    static unsigned char header;
    static unsigned char dataType;
    static std::vector<unsigned char> data;
    static unsigned char checkSum;

    static std::string commandType;

    static std::string parseCommand(const std::string& command);
    static std::vector<unsigned char> hexStringToByteArray(const std::string& s);
    static unsigned char calculateChecksum(unsigned char dataType, const std::vector<unsigned char>& data);
    static std::string processOperatorCommand(const std::string& operatorCommand);

    // 各个 dataType 处理函数的声明
    static std::string handleAppInit();
    static std::string handleAppSetting();
    static std::string handleAppReset();
    static std::string handleSetIncline();
    static std::string handleCalibrate();
    static std::string handleDiagnostics();
    static std::string handleWorkoutData();
    static std::string handleStateChanged();
    static std::string handleError();
    static bool checkDataACK();

    static std::string BuildCommandStringData(const std::string& header, const std::string& dataType, const std::string& data);
    static std::string InitCommand();
    static std::string SettingCommand(int set);
    static std::string ResetCommand();
    static std::string SetInclineCommand(float incline);
    static std::string CalibrateCommand();
    static std::string DiagnosticsCommand(int option);
    static std::string StateChangedCommand();
    static std::string ErrorDataCommand();

    static int getTreadmillState();
};

#endif //TREADMILL_TREADMILLCOMMANDUTIL_H
